package com.ximcontroller.controllers;

import java.util.Collection;

import com.ximcontroller.models.*;
import com.ximcontroller.models.elements.*;

public class WSController
{
	
	Workspace target;
	
	public WSController()
	{
		this.initialize();
	}
	
	public WSController(Workspace target)
	{
		this.target = target;
	}
	
	public void initialize()
	{
		this.target = new Workspace();
	}
	
	public Workspace getTarget()
	{
		return this.target;
	}
	
	public void setTarget(Workspace target)
	{
		this.target = target;
	}
	
	public void addProject(Project p)
	{
		this.getTarget().addProject(p);
	}
	
	public void addElement(Element e)
	{
		this.target.addElement(e);
	}
	
	public void removeElement(int id)
	{
		this.target.removeElement(id);
	}
	
	public Collection<? extends Element>  getElements()
	{
		return this.target.listElements();
	}
	
	public void doAction(Action action)
	{
		action.setWorkspace(this.getTarget());
		action.doAction();
	}
}
